<template>
	<div id="now">
		<ul>
			<li v-for="item in nowPlayData" :key="item.id">
				<div class="first">
					<img :src="item.img">
				</div>
				<div class="second">
					<p class="title">{{item.title}}</p>
					<p><span class="font-color">观众评</span><span class="score">{{item.score}}</span></p>
					<p class="actors font-color">{{item.actors}}</p>
					<p class="font-color">{{item.nums}}</p>
				</div>
				<div class="third">
					<button type="button">购票</button>
				</div>
			</li>
		</ul>
	</div>
</template>

<script>
	export default {
		name: 'Now',
		data() {
			return {
				nowPlayData: []
			}
		},
		methods: {
			getNowPlayData() {
				var that = this
				axios.get('/mock/nowPlayData.json').then(function(response) {
					console.log(response)
					if (response.status == 200) {
						if(response.data && response.data.nowPlayData){
							that.nowPlayData = response.data.nowPlayData
						}
					}
				}).catch(function(error) {
					console.log(error)
				})
			}
		},
		created(){
			  this.getNowPlayData()
		}
	}
</script>

<style scoped>
	#now{
		margin-bottom: 30px;
	}
	p {
		margin-top: 5px;
	}

	img {
		width: 100px;
	}

	/* div{
		float: left;
	} */
	li {
		overflow: hidden;
		width: 95%;
		padding: 5px 5px;
		display: flex;
		justify-content: space-around;
		border-bottom: 1px solid lightgray;
	}

	.first {
		width: 24%;
	}

	.second {
		width: 50%;
	}

	.third {
		width: 15%;
		margin-top: 30px;
	}

	.actors {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	p {
		line-height: 25px;
	}

	.title {
		font-size: 18px;
		font-weight: bold;
	}

	.font-color {
		color: #666;
	}

	.score {
		color: #FF9900;
	}

	button {
		background: #E54847;
		width: 45px;
		height: 22px;
		line-height: 22px;
		text-align: center;
		color: white;
		border: none;
		border-radius: 8px;
	}
</style>
